const fs = require('fs')
//开始读取
fs.readFile('./a.txt', 'utf8', (err, data) => {
  if (err) return console.log('读失败')

  //开始写入
  fs.writeFile('./b.txt', data, 'utf8', err => {
    if (err) return console.log('写失败')
    console.log('成功')
  })
})